package com.service.vecc;

import com.common.ErrorCodeEnum;
import com.common.emums.DataStatus;
import com.common.exception.BusinessException;
import com.common.utils.StringUtils;
import com.core.springSecurity.common.SecurityUtils;

import com.dao.primary.vecc.VeccDeviceModelAuthRecordInfoMapper;
import com.model.domain.vecc.GetVeccDeviceModelAuthRecordInfoDO;
import com.model.pojo.vecc.VeccDeviceModelAuthRecordInfo;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import com.github.pagehelper.PageHelper;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;


/**
 * @Author: zql
 * @Description: 国四环保监控终端型号授权记录信息服务
 * @Data: 2024-02-21
 */
@Slf4j
@Service
@RequiredArgsConstructor
public class VeccDeviceModelAuthRecordInfoService {
    private final VeccDeviceModelAuthRecordInfoMapper veccDeviceModelAuthRecordInfoMapper;

    public List<VeccDeviceModelAuthRecordInfo> getPageList(GetVeccDeviceModelAuthRecordInfoDO getVeccDeviceModelAuthRecordInfoDO){
        PageHelper.clearPage();
        PageHelper.startPage(getVeccDeviceModelAuthRecordInfoDO.getPage(),getVeccDeviceModelAuthRecordInfoDO.getPageSize(),getVeccDeviceModelAuthRecordInfoDO.getSortRow()+getVeccDeviceModelAuthRecordInfoDO.getSortOrder());
        return veccDeviceModelAuthRecordInfoMapper.selectList(getVeccDeviceModelAuthRecordInfoDO);
    }

    public VeccDeviceModelAuthRecordInfo getById(Long recordId){
        return veccDeviceModelAuthRecordInfoMapper.selectByPrimaryKey(recordId);
    }
    public int save(VeccDeviceModelAuthRecordInfo recordInfo){
        recordInfo.setCreatedTime(new Date());
        return veccDeviceModelAuthRecordInfoMapper.insertSelective(recordInfo);
    }
    public int update(VeccDeviceModelAuthRecordInfo recordInfo){
        recordInfo.setLastModifiedTime(new Date());
        return veccDeviceModelAuthRecordInfoMapper.updateByPrimaryKeySelective(recordInfo);
    }
}
